package com.ima;

import android.view.Gravity;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.WindowManager;
import android.widget.LinearLayout;
import android.widget.TextView;
import com.fb.FileBrowserPage;
import com.dev.CheckableItem;
import com.dev.GUI;
import com.dev.IconViewClose;
import com.dev.MainActivity;

class QueryPaint extends LinearLayout implements OnClickListener{
	WindowManager.LayoutParams wlp=new WindowManager.LayoutParams();
	LinearLayout titlebar;
	IconViewClose close;
	TextView title;
	FileBrowserPage.Item itStrokeWidth;
	FileBrowserPage.Item itCap;
	FileBrowserPage.Item itJoin;
	CheckableItem itStroke;
	CheckableItem itFill;
	MainActivity ma;
	QueryPaint(MainActivity ma){
		super(ma);
		this.ma=ma;
		setOrientation(VERTICAL);
		setBackground(new GUI.BorderDrawable());
		int textSize=(int)(13*ma.dp);
		int padding=9;
		close=new IconViewClose(ma);
		close.setOnClickListener(this);
		title=new TextView(ma);
		title.setText("绘制参数");
		title.setGravity(Gravity.CENTER_VERTICAL);
		title.setPadding(padding,0,0,0);
		title.getPaint().setTextSize(textSize);
		titlebar=new LinearLayout(ma);
		titlebar.setOrientation(HORIZONTAL);
		titlebar.setBackground(new GUI.BorderDrawable());
		titlebar.addView(title,new LayoutParams(0,-1,1f));
		titlebar.addView(close);
		itStrokeWidth=new FileBrowserPage.Item(ma);
		itStrokeWidth.setText("笔划宽度");
		itStrokeWidth.setOnClickListener(this);
		itCap=new FileBrowserPage.Item(ma);
		itCap.setText("线帽");
		itCap.setOnClickListener(this);
		itJoin=new FileBrowserPage.Item(ma);
		itJoin.setText("线拐角");
		itJoin.setOnClickListener(this);
		LayoutParams itlp=new LayoutParams(-1,ma.dialogTitleBarHeight);
		addView(titlebar,-1,ma.dialogTitleBarHeight);
		addView(itStrokeWidth,itlp);
		addView(itCap,itlp);
		addView(itJoin,itlp);
	}
	void show(){
		wlp.width=ma.wp*4/5;
		wlp.height=-2;
		ma.wm.addView(this,wlp);
	}

	@Override
	public void onClick(View view) {
		if(view==close){
			ma.wm.removeView(this);
		}
	}
}
